using System;
using UnityEngine;

[RequireComponent(typeof(AudioSource))]
public class ObjectSpawn : MonoBehaviour
{
	public string ItemID = string.Empty;

	public string ItemUID = string.Empty;

	public GameObject Item;

	public int Group = 2;

	private void Start()
	{
		if ((bool)Item)
		{
			GameObject gameObject = UnityEngine.Object.Instantiate(Item, base.transform.position, base.transform.rotation);
			gameObject.SendMessage("SetItemID", ItemID, SendMessageOptions.DontRequireReceiver);
			gameObject.SendMessage("SetItemUID", ItemUID, SendMessageOptions.DontRequireReceiver);
		}
		UnityEngine.Object.Destroy(base.gameObject);
	}

	public void SetItemID(string id)
	{
		ItemID = id;
	}

	public void SetItemUID(string uid)
	{
		ItemUID = uid;
	}

	public void GenItemUID()
	{
		ItemUID = GetUniqueID();
	}

	private void Update()
	{
	}

	public string GetUniqueID()
	{
		System.Random random = new System.Random();
		DateTime d = new DateTime(1970, 1, 1, 8, 0, 0, DateTimeKind.Utc);
		double totalSeconds = (DateTime.UtcNow - d).TotalSeconds;
		return $"{Convert.ToInt32(totalSeconds):X}" + "-" + $"{Convert.ToInt32(Time.time * 1000000f):X}" + "-" + $"{random.Next(1000000000):X}";
	}
}
